<?php
namespace Futures\Controller;
use Common\Model\OptionModel;
use Common\Model\QuotationModel;
/**
 *  自动更新执行的控制器
 */
class GetDataController{


    public function get_euro_data(){
        //$Mongo= new \Common\Model\OptionModel('optiondatas');
		$Mongo= new QuotationModel('optiondatas');
        $where['type'] = 2;
        $datas = $Mongo->where($where)->order('id desc')->limit(1)->select();
        foreach($datas as $k=>$v){
            $data=$v;
        }
        unset($data['_id']);
        echo json_encode($data);
    }

    public function get_stock_data(){
        //$Mongo= new \Common\Model\OptionModel('optiondatas');
        $Mongo= new QuotationModel('optiondatas');
        $where['type'] = 1;
        $datas = $Mongo->where($where)->order('id desc')->limit(1)->select();
        foreach($datas as $k=>$v){
            $data=$v;
        }
        unset($data['_id']);
        echo json_encode($data);
    }
	
	public function get_gold_data(){
        //$Mongo= new \Common\Model\OptionModel('optiondatas');
        $Mongo= new QuotationModel('optiondatas');
        $where['type'] = 3;
        $datas = $Mongo->where($where)->order('id desc')->limit(1)->select();
        foreach($datas as $k=>$v){
            $data=$v;
        }
        unset($data['_id']);
        echo json_encode($data);
    }
	
	public function get_dollar_data(){
        //$Mongo= new \Common\Model\OptionModel('optiondatas');
        $Mongo= new QuotationModel('optiondatas');
        $where['type'] = 4;
        $datas = $Mongo->where($where)->order('id desc')->limit(1)->select();
        foreach($datas as $k=>$v){
            $data=$v;
        }
        unset($data['_id']);
        echo json_encode($data);
    }
	
	public function get_dax_data(){
        //$Mongo= new \Common\Model\OptionModel('optiondatas');
        $Mongo= new QuotationModel('optiondatas');
        $where['type'] = 5;
        $datas = $Mongo->where($where)->order('id desc')->limit(1)->select();
        foreach($datas as $k=>$v){
            $data=$v;
        }
        unset($data['_id']);
        echo json_encode($data);
    }
   
}